#ifndef _CSF_H_
#define _CSF_H_

#include "PocoHeaders.h"
#include <string>
#include <vector>

#define METHOD_HTTPREQUEST  "httpRequest"
#define METHOD_HTTPRESPONSE "httpResponse"

class SCSFData
{
public:
    std::string strUUID;
    std::string strMethod;
    std::string strSYYCData;
};

class SCSF : public Poco::Runnable
{
public:
    static SCSF* Initialize();
    static SCSF* GetInstance();

public:
    int Start();
    int Stop();

public:
    void WriteHttpRequest(std::string strSYYCUUID, std::string strData);
    void WriteHttpResponse(std::string strSYYCUUID, std::string strData);
    std::string read(std::string strSYYCUUID, std::string strMethod);

private:
    SCSF();
    ~SCSF();
    virtual void run();
    void Routine();

private:
    void SaveRSCSFData(std::string strData);

private:
    Poco::Mutex           m_mutexWSCSFData;
    std::vector<SCSFData> m_vectWSCSFData;

    Poco::Mutex           m_mutexRSCSFData;
    std::vector<SCSFData> m_vectRSCSFData;

private:
    static SCSF* m_pInstance;

private:
    Poco::Thread m_thread;
    bool         m_bStop;
    Poco::Event  m_ready;
};

#endif // !_CSF_H_
